package com.cskaoyan.service;

import com.cskaoyan.bean.DashBoardVO;
import com.cskaoyan.mapper.GoodsMapper;
import com.cskaoyan.mapper.GoodsProductMapper;
import com.cskaoyan.mapper.OrderMapper;
import com.cskaoyan.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class HomepageServiceImpl implements HomepageService {

    @Autowired
    UserMapper userMapper;

    @Autowired
    GoodsMapper goodsMapper;

    @Autowired
    GoodsProductMapper goodsProductMapper;

    @Autowired
    OrderMapper orderMapper;

    @Override
    public DashBoardVO queryDashBoard() {
        DashBoardVO dashBoardVO = new DashBoardVO();
        dashBoardVO.setUserTotal(userMapper.selectTotalUser());
        dashBoardVO.setGoodsTotal(goodsMapper.selectTotalGoods());
        dashBoardVO.setProductTotal(goodsProductMapper.selectTotalProduct());
        dashBoardVO.setOrderTotal(orderMapper.selectTotalOrder());
        return dashBoardVO;
    }
}
